<?php
/**
 * 产品图片模型
 * (model)
 */
namespace App\Models\Product;

use Illuminate\Database\Eloquent\Model;
class ProductImage extends Model
{
    protected $table = 'product_image';

    protected $guarded = [];

    public $timestamps = false;

    public function setPicsAttribute($pics){
        if (is_array($pics)) {
            $this->attributes['pics'] = json_encode($pics);
        }
    }

    public function getPicsAttribute($pics){
        return json_decode($pics, true);
    }
}
